﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.85    敏感信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_SYS_SENSINFO: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_SYS_SENSINFO()
		{}
		#region Model
		private long _id;
		private string _infotype= "1";
		private string _name;
		private string _idcard;
		private string _cardaddr;
		private string _homeaddr;
		private string _sex;
		private string _post;
		private string _postaddr;
		private string _mobile;
		private string _hometelcode;
		private string _hometel;
		private string _posttelcode;
		private string _posttel;
		private string _jobunit;
		private string _jobtelcode;
		private string _jobtel;
		private string _jobtelsub;
		private string _spousename;
		private string _spousemobile;
		private string _spousetelcode;
		private string _spousetel;
		private Nullable<DateTime> _createtime;
		private string _createby;
		private Nullable<DateTime> _modifytime;
		private string _modifyby;
		private string _remark;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 信息类别,1黑名单，2员工,3员工亲属
		/// </summary>
		[DataMember]
		public string INFOTYPE
		{
			get{return _infotype;}
			set{
				if ( _infotype!= value)
				{
					 _infotype = value;
					OnPropertyChanged("INFOTYPE");
				}
			}
		}
		/// <summary>
		/// 姓名
		/// </summary>
		[DataMember]
		public string NAME
		{
			get{return _name;}
			set{
				if ( _name!= value)
				{
					 _name = value;
					OnPropertyChanged("NAME");
				}
			}
		}
		/// <summary>
		/// 身份证号
		/// </summary>
		[DataMember]
		public string IDCARD
		{
			get{return _idcard;}
			set{
				if ( _idcard!= value)
				{
					 _idcard = value;
					OnPropertyChanged("IDCARD");
				}
			}
		}
		/// <summary>
		/// 证件地址
		/// </summary>
		[DataMember]
		public string CARDADDR
		{
			get{return _cardaddr;}
			set{
				if ( _cardaddr!= value)
				{
					 _cardaddr = value;
					OnPropertyChanged("CARDADDR");
				}
			}
		}
		/// <summary>
		/// 家庭住址
		/// </summary>
		[DataMember]
		public string HOMEADDR
		{
			get{return _homeaddr;}
			set{
				if ( _homeaddr!= value)
				{
					 _homeaddr = value;
					OnPropertyChanged("HOMEADDR");
				}
			}
		}
		/// <summary>
		/// 性别
		/// </summary>
		[DataMember]
		public string SEX
		{
			get{return _sex;}
			set{
				if ( _sex!= value)
				{
					 _sex = value;
					OnPropertyChanged("SEX");
				}
			}
		}
		/// <summary>
		/// 籍贯
		/// </summary>
		[DataMember]
		public string POST
		{
			get{return _post;}
			set{
				if ( _post!= value)
				{
					 _post = value;
					OnPropertyChanged("POST");
				}
			}
		}
		/// <summary>
		/// 户籍地地址
		/// </summary>
		[DataMember]
		public string POSTADDR
		{
			get{return _postaddr;}
			set{
				if ( _postaddr!= value)
				{
					 _postaddr = value;
					OnPropertyChanged("POSTADDR");
				}
			}
		}
		/// <summary>
		/// 手机
		/// </summary>
		[DataMember]
		public string MOBILE
		{
			get{return _mobile;}
			set{
				if ( _mobile!= value)
				{
					 _mobile = value;
					OnPropertyChanged("MOBILE");
				}
			}
		}
		/// <summary>
		/// 家庭电话区号
		/// </summary>
		[DataMember]
		public string HOMETELCODE
		{
			get{return _hometelcode;}
			set{
				if ( _hometelcode!= value)
				{
					 _hometelcode = value;
					OnPropertyChanged("HOMETELCODE");
				}
			}
		}
		/// <summary>
		/// 家庭电话
		/// </summary>
		[DataMember]
		public string HOMETEL
		{
			get{return _hometel;}
			set{
				if ( _hometel!= value)
				{
					 _hometel = value;
					OnPropertyChanged("HOMETEL");
				}
			}
		}
		/// <summary>
		/// 户籍电话区号
		/// </summary>
		[DataMember]
		public string POSTTELCODE
		{
			get{return _posttelcode;}
			set{
				if ( _posttelcode!= value)
				{
					 _posttelcode = value;
					OnPropertyChanged("POSTTELCODE");
				}
			}
		}
		/// <summary>
		/// 户籍电话
		/// </summary>
		[DataMember]
		public string POSTTEL
		{
			get{return _posttel;}
			set{
				if ( _posttel!= value)
				{
					 _posttel = value;
					OnPropertyChanged("POSTTEL");
				}
			}
		}
		/// <summary>
		/// 工作单位
		/// </summary>
		[DataMember]
		public string JOBUNIT
		{
			get{return _jobunit;}
			set{
				if ( _jobunit!= value)
				{
					 _jobunit = value;
					OnPropertyChanged("JOBUNIT");
				}
			}
		}
		/// <summary>
		/// 单位电话区号
		/// </summary>
		[DataMember]
		public string JOBTELCODE
		{
			get{return _jobtelcode;}
			set{
				if ( _jobtelcode!= value)
				{
					 _jobtelcode = value;
					OnPropertyChanged("JOBTELCODE");
				}
			}
		}
		/// <summary>
		/// 单位电话
		/// </summary>
		[DataMember]
		public string JOBTEL
		{
			get{return _jobtel;}
			set{
				if ( _jobtel!= value)
				{
					 _jobtel = value;
					OnPropertyChanged("JOBTEL");
				}
			}
		}
		/// <summary>
		/// 单位电话分机号
		/// </summary>
		[DataMember]
		public string JOBTELSUB
		{
			get{return _jobtelsub;}
			set{
				if ( _jobtelsub!= value)
				{
					 _jobtelsub = value;
					OnPropertyChanged("JOBTELSUB");
				}
			}
		}
		/// <summary>
		/// 配偶姓名
		/// </summary>
		[DataMember]
		public string SPOUSENAME
		{
			get{return _spousename;}
			set{
				if ( _spousename!= value)
				{
					 _spousename = value;
					OnPropertyChanged("SPOUSENAME");
				}
			}
		}
		/// <summary>
		/// 配偶手机
		/// </summary>
		[DataMember]
		public string SPOUSEMOBILE
		{
			get{return _spousemobile;}
			set{
				if ( _spousemobile!= value)
				{
					 _spousemobile = value;
					OnPropertyChanged("SPOUSEMOBILE");
				}
			}
		}
		/// <summary>
		/// 配偶固定电话区号
		/// </summary>
		[DataMember]
		public string SPOUSETELCODE
		{
			get{return _spousetelcode;}
			set{
				if ( _spousetelcode!= value)
				{
					 _spousetelcode = value;
					OnPropertyChanged("SPOUSETELCODE");
				}
			}
		}
		/// <summary>
		/// 配偶固定电话
		/// </summary>
		[DataMember]
		public string SPOUSETEL
		{
			get{return _spousetel;}
			set{
				if ( _spousetel!= value)
				{
					 _spousetel = value;
					OnPropertyChanged("SPOUSETEL");
				}
			}
		}
		/// <summary>
		/// 创建时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATETIME
		{
			get{return _createtime;}
			set{
				if ( _createtime!= value)
				{
					 _createtime = value;
					OnPropertyChanged("CREATETIME");
				}
			}
		}
		/// <summary>
		/// 创建人
		/// </summary>
		[DataMember]
		public string CREATEBY
		{
			get{return _createby;}
			set{
				if ( _createby!= value)
				{
					 _createby = value;
					OnPropertyChanged("CREATEBY");
				}
			}
		}
		/// <summary>
		/// 修改时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> MODIFYTIME
		{
			get{return _modifytime;}
			set{
				if ( _modifytime!= value)
				{
					 _modifytime = value;
					OnPropertyChanged("MODIFYTIME");
				}
			}
		}
		/// <summary>
		/// 修改时间
		/// </summary>
		[DataMember]
		public string MODIFYBY
		{
			get{return _modifyby;}
			set{
				if ( _modifyby!= value)
				{
					 _modifyby = value;
					OnPropertyChanged("MODIFYBY");
				}
			}
		}
		/// <summary>
		/// 备注
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

